package com.cloudspace.jindun.network.api;

import com.cloudspace.jindun.locate.LocateApi;
import com.cloudspace.jindun.rongyun.ChannelApi;
import com.cloudspace.jindun.rongyun.RongyunApi;
import com.cloudspace.jindun.update.UpdateApi;

/**
 * Created by zengxianhua on 16/12/15.
 */

public class API {
    private static API api;

    private HomeApi homeApi;
    private RongyunApi rongyunApi;
    private LoginApi mLoginApi;
    private ChannelApi channelApi;
    private OrigApi orgApi;
    private LocateApi locateApi;
    private UpdateApi updateApi;

    private NoticeApi noticeApi;

    public synchronized LoginApi getLoginApi() {
        if (mLoginApi == null) {
            mLoginApi = new LoginApi();
        }
        return mLoginApi;
    }

    public static API getInstance() {
        if (api == null) {
            api = new API();
        }
        return api;
    }

    public synchronized HomeApi getHomeApi() {
        if (homeApi == null) {
            homeApi = new HomeApi();
        }
        return homeApi;
    }

    public  synchronized RongyunApi getRongyunApi(){
        if (rongyunApi == null){
            rongyunApi = new RongyunApi();
        }
        return rongyunApi;
    }

    public  synchronized OrigApi getOrgApi(){
        if (orgApi == null){
            orgApi = new OrigApi();
        }
        return orgApi;
    }

    public  synchronized ChannelApi getChannelApi(){
        if (channelApi == null){
            channelApi = new ChannelApi();
        }
        return channelApi;
    }

    public  synchronized LocateApi getLocateApi(){
        if (locateApi == null){
            locateApi = new LocateApi();
        }
        return locateApi;
    }

    public synchronized UpdateApi getUpdateApi(){
        if (updateApi == null){
            updateApi = new UpdateApi();
        }

        return updateApi;
    }

    public synchronized NoticeApi getNoticeApi(){
        if (noticeApi == null){
            noticeApi = new NoticeApi();
        }

        return noticeApi;
    }
}
